package dsk.demo.product.util;

import lombok.RequiredArgsConstructor;
import org.springframework.cache.CacheManager;
import org.springframework.stereotype.Component;

@Component
@RequiredArgsConstructor
public class CacheUtil {
    private final CacheManager cacheManager;

    public void setValue(String key, String value) {
        cacheManager.getCache("manager").put(key, value);
    }

    public String getValue(String key) {
        return cacheManager.getCache("manager").get(key, String.class);
    }

    public void deleteValue(String key) {
        cacheManager.getCache("manager").evict(key);
    }
}
